package domain

import (
	"github.com/lab-online/internal/user/entity"
	"github.com/lab-online/internal/user/valueobject"
	"github.com/lab-online/pkg/auth"
	"github.com/lab-online/pkg/jwt"
)

type UserDomain interface {
	AddUser(entity.UserEntity, auth.AuthEntity) (entity.UserEntity, error)
	DeleteUser(entity.UserEntity) error
	GetUser(entity.UserEntity) (entity.UserEntity, error)
	ImportStudent([]entity.UserEntity) ([]entity.UserEntity, error)
	Login(entity.UserEntity) (accessToken string, refreshToken string, e error)
	RefreshToken(refreshToken string) (string, error)
	UpdateUser(auth.AuthEntity, entity.UserEntity) (entity.UserEntity, error)
	UpdatePassword(auth.AuthEntity, *valueobject.PasswordPatch) error
	SearchUser(entity.UserEntity) ([]entity.UserEntity, error)
}

type Domain struct {
	repository UserRepository
	jwt        jwt.JWTAction
}

func New(repository UserRepository, jwt jwt.JWTAction) UserDomain {
	return &Domain{repository, jwt}
}
